<template>
<div>
    <el-button type="deleteAll" icon="el-icon-delete" @click="deleteAllVisible = true" v-if="_SHOWBTN(showBetCode)">删除</el-button>
    <el-dialog width="432px" title="删除提示" :visible.sync="deleteAllVisible">
        <i>
            <img src="@/assets/image/Shape.png" alt />
        </i>
        <span>{{title}}</span>
        <span slot="footer" class="dialog-footer">
            <el-button type="primary" @click="ClearAll">确 定</el-button>
            <el-button type="cancel" @click="deleteAllVisible = false">取 消</el-button>
        </span>
    </el-dialog>
</div>
</template>

<script>
export default {
    props: ["title", "multipleSelection", "getBannerList", "type", "showBetCode"],
    data() {
        return {
            deleteAllVisible: false,
            ids: [],
        };
    },
    methods: {
        handleClose(done) {
            this.$confirm("确认关闭？")
                .then((_) => {
                    done();
                })
                .catch((_) => {});
        },
        ClearAll() {
            // this.deleteAllVisible = false;
            // console.log(this.multipleSelection, "kankan");
            if (this.multipleSelection.length > 0) {
                let ids = [];
                // console.log(this.multipleSelection,121212)
                this.multipleSelection.forEach(function (item, index, array) {
                    // console.log(item.id)
                    ids.push({
                        id: item.id,
                    });
                });
                // console.log(ids)
                // console.log(this.type,1111)
                if (this.type === "4") {
                    this.Api.getArmedClear({
                        ids: ids
                    }).then((res) => {
                        // console.log(res,12121212)
                        if (res.code === "0") {
                            // console.log(res,12121212)
                            this.getBannerList();
                            this.deleteAllVisible = false;
                        }
                    });
                } else {
                    this.Api.getBannerListClear({
                        ids: ids,
                        type: this.type
                    }).then(
                        (res) => {
                            //  console.log(res,12121212)
                            if (res.code === "0") {
                                // console.log(res,12121212)
                                this.getBannerList();
                                this.deleteAllVisible = false;
                            }
                        }
                    );
                }
            } else {
                this.$message.error("请勾选删除项");
                this.deleteAllVisible = false;
            }
        },
    },
};
</script>

<style lang="less" scoped>
/deep/.el-button--deleteAll {
    width: 80px;
    height: 36px;
    background: rgba(255, 255, 255, 1);
    border-radius: 3px;
    border: 1px solid rgba(251, 54, 63, 1);
    padding: 0;
    color: #fb363f;
}

/deep/.el-dialog {
    margin-top: 19% !important;
    box-shadow: 0px 4px 12px 0px rgba(0, 0, 0, 0.15);
    border-radius: 4px;

    >.el-dialog__header {
        padding-left: 70px;
        padding-bottom: 0;

        >span {
            font-size: 16px;
            font-family: PingFangSC-Medium, PingFang SC;
            font-weight: 500;
            color: rgba(0, 0, 0, 0.85);
            line-height: 24px;
        }
    }

    >.el-dialog__body {
        padding-left: 70px;
        padding-top: 12px;
        padding-bottom: 24px;
        position: relative;

        >i {
            position: absolute;
            left: 32px;
            top: -22px;
        }

        >span {
            font-size: 14px;
            font-family: PingFangSC-Regular, PingFang SC;
            font-weight: 400;
            color: rgba(102, 102, 102, 1);
        }
    }

    >.el-dialog__footer {
        .el-button--primary {
            width: 65px;
            height: 32px;
            background: rgba(22, 119, 255, 1);
            padding: 0;
            color: white;
        }

        .el-button--cancel {
            width: 65px;
            height: 32px;
            background: rgba(250, 250, 250, 1);
            border: 1px solid rgba(221, 221, 221, 1);
            font-size: 14px;
            font-family: PingFangSC-Regular, PingFang SC;
            font-weight: 400;
            color: rgba(102, 102, 102, 1);
            padding: 0;
            margin-left: 8px;
        }
    }
}
</style>
